﻿using LD.Host;
using LdCommunication;

namespace LD.PLC
{
    public abstract class PLCAbstract : ICommunicate
    {

        public virtual Status Status { get; set; }

        public virtual event ConnectionStatusDelegate StatusEvent;
        public abstract OperateResult<byte[]> Read(string address, ushort val);
        public abstract OperateResult<bool[]> ReadBool(string address, ushort val);
        public abstract OperateResult<bool> ReadBool(string address);
        public abstract OperateResult<string> ReadString(string address, ushort val);
        public abstract OperateResult<int> ReadInt(string address);
        public abstract OperateResult<int[]> ReadInt(string address, ushort val);
        public abstract OperateResult<short> ReadInt16(string address);
        public abstract OperateResult<short[]> ReadInt16(string address, ushort val);
        public abstract OperateResult<float> ReadFloat(string address);
        public abstract OperateResult<float[]> ReadFloat(string address, ushort val);
        public abstract OperateResult Write(string address, short val);
        public abstract OperateResult Write(string address, int val);
        public abstract OperateResult Write(string address, bool val);
        public abstract OperateResult Write(string address, string val);
        public abstract OperateResult Write(string address, byte[] val);
        public abstract OperateResult Write(string address, float val);
        public abstract OperateResult Write(string address, double val);
        public abstract bool Wait(string address, short val, int timeout);
        public abstract bool Wait(string address, bool val, int timeout);
        public virtual void Start()
        {
        }

        public virtual void Stop()
        {
        }

        public TB_HD HDParam { get; set; }
        public string Name { get; set; }
    }
}
